import java.util.Scanner;

/**
 * @Author wonghiu
 * @Date 2021/6/29 15:11
 * @Version 1.0.1
 */
public class sanliulingbishi {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        System.out.println(solution(str)%1000000007);
    }
    public static long solution(String str){
        long r = 0;
        long t = 0;
        int len = str.length();
        for (int i = len-1; i >=0 ; i--) {
            if (str.charAt(i)=='b'){
                t=(t+1)%1000000007;
            }
            else if (str.charAt(i)=='a'){
                r = (r+t)%1000000007;
                t = (t*2)%1000000007;
            }
        }
        return r;
    }
}
